package cn.tedu.collection;/**
 * @Author 金帮嘉诚 @Date 2021-06-21 星期一 19:08
 */
/*本类用于测试*/

import java.util.ArrayList;
import java.util.Iterator;
import java.util.ListIterator;

/**
 * 知识点
 * this.toString()
 * this引用当前对象的地址
 */
public class T {
    public static void main(String[] args) {
        A a = new A();
        a.me();
        System.out.println("a.toString() = " + a.toString());
        System.out.println("1");
        //
        char[] i=new char[5];
        //
        char[] i2=new char[]{'1'};
        char[] i3={'2'};
        //
        ArrayList<String> c=new ArrayList<>();
        c.add("001");
        c.add("002");
        c.add("003");
        c.add("004");
        c.add("005");
        c.add("006");

        for (int j = 0; j <c.size() ; j++) {
            System.out.println(c.get(j));
        }
        for (String s:c
             ) {
            System.out.println(s);
        }
        Iterator it1=c.iterator();
        while (it1.hasNext()){
            System.out.println(it1.next());
        }
        ListIterator it2=c.listIterator();
        while (it2.hasNext()){
            System.out.println(it2.next());
        }


    }
}

class A {
    String name;

    public void me() {
        System.out.println(this.toString());
    }

    public A() {
    }

    public A(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}
